<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/3/24 0024
 * Time: 14:30
 */

namespace app\admin\model;


use think\facade\Db;
use think\Model;

class Brand extends Model{
    protected $pk='brand_id';
    public static function getBrandList($where,$whereOr){

        $brand=Brand::where($where)->where(function ($query) use ($whereOr){
            $query->whereOr($whereOr);
        })
        ->paginate([

            'list_rows'=> 5,//每页数量

            'query' => request()->param(),

        ]);


        return $brand;
    }
    public static function goodsPinList(){
        $pin=Brand::select();
        return $pin;

    }
    public static function brandAdd($data)
    {

        $brandAdd=new Brand();
        try{
            $res=$brandAdd->save($data);
            $msg='成功';
        }catch (\Exception $e){
            $res=false;
            $msg=$e->getMessage();
        }
        return[$res,$msg];
    }

    public static function editBrandList($data)
    {
        try{
            $res=Brand::update($data);
            $msg='成功';
        }catch (\Exception $e){
            $res=false;
            $msg=$e->getMessage();
        }
        return[$res,$msg];
    }

}
